{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath('__file__')))\n",
    "PATH = os.path.join(BASE_DIR, 'umatrix.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\蓝沛辉\\\\Desktop\\\\Django项目\\\\recommend_system\\\\umatrix.csv'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PATH"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv(open( os.path.join(BASE_DIR, 'umatrix.csv')))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user</th>\n",
       "      <th>Toy Story (1995);1</th>\n",
       "      <th>GoldenEye (1995);2</th>\n",
       "      <th>Four Rooms (1995);3</th>\n",
       "      <th>Get Shorty (1995);4</th>\n",
       "      <th>Copycat (1995);5</th>\n",
       "      <th>Twelve Monkeys (1995);7</th>\n",
       "      <th>Babe (1995);8</th>\n",
       "      <th>Dead Man Walking (1995);9</th>\n",
       "      <th>Richard III (1995);10</th>\n",
       "      <th>...</th>\n",
       "      <th>Cool Runnings (1993);1035</th>\n",
       "      <th>Hamlet (1996);1039</th>\n",
       "      <th>Forget Paris (1995);1041</th>\n",
       "      <th>Multiplicity (1996);1047</th>\n",
       "      <th>She's the One (1996);1048</th>\n",
       "      <th>Koyaanisqatsi (1983);1065</th>\n",
       "      <th>Shallow Grave (1994);1073</th>\n",
       "      <th>Reality Bites (1994);1074</th>\n",
       "      <th>Six Degrees of Separation (1993);1101</th>\n",
       "      <th>Some Kind of Wonderful (1987);1119</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 604 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   user  Toy Story (1995);1  GoldenEye (1995);2  Four Rooms (1995);3  \\\n",
       "0   1.0                 5.0                 3.0                  4.0   \n",
       "1   2.0                 4.0                 0.0                  0.0   \n",
       "2   3.0                 0.0                 0.0                  0.0   \n",
       "3   4.0                 0.0                 0.0                  0.0   \n",
       "4   5.0                 4.0                 3.0                  0.0   \n",
       "\n",
       "   Get Shorty (1995);4  Copycat (1995);5  Twelve Monkeys (1995);7  \\\n",
       "0                  3.0               3.0                      4.0   \n",
       "1                  0.0               0.0                      0.0   \n",
       "2                  0.0               0.0                      0.0   \n",
       "3                  0.0               0.0                      0.0   \n",
       "4                  0.0               0.0                      0.0   \n",
       "\n",
       "   Babe (1995);8  Dead Man Walking (1995);9  Richard III (1995);10  \\\n",
       "0            1.0                        5.0                    3.0   \n",
       "1            0.0                        0.0                    2.0   \n",
       "2            0.0                        0.0                    0.0   \n",
       "3            0.0                        0.0                    0.0   \n",
       "4            0.0                        0.0                    0.0   \n",
       "\n",
       "                  ...                  Cool Runnings (1993);1035  \\\n",
       "0                 ...                                        0.0   \n",
       "1                 ...                                        0.0   \n",
       "2                 ...                                        0.0   \n",
       "3                 ...                                        0.0   \n",
       "4                 ...                                        0.0   \n",
       "\n",
       "   Hamlet (1996);1039  Forget Paris (1995);1041  Multiplicity (1996);1047  \\\n",
       "0                 0.0                       0.0                       0.0   \n",
       "1                 0.0                       0.0                       0.0   \n",
       "2                 0.0                       0.0                       0.0   \n",
       "3                 0.0                       0.0                       0.0   \n",
       "4                 0.0                       0.0                       0.0   \n",
       "\n",
       "   She's the One (1996);1048  Koyaanisqatsi (1983);1065  \\\n",
       "0                        0.0                        0.0   \n",
       "1                        0.0                        0.0   \n",
       "2                        0.0                        0.0   \n",
       "3                        0.0                        0.0   \n",
       "4                        0.0                        0.0   \n",
       "\n",
       "   Shallow Grave (1994);1073  Reality Bites (1994);1074  \\\n",
       "0                        0.0                        0.0   \n",
       "1                        0.0                        0.0   \n",
       "2                        0.0                        0.0   \n",
       "3                        0.0                        0.0   \n",
       "4                        0.0                        0.0   \n",
       "\n",
       "   Six Degrees of Separation (1993);1101  Some Kind of Wonderful (1987);1119  \n",
       "0                                    0.0                                 0.0  \n",
       "1                                    0.0                                 0.0  \n",
       "2                                    0.0                                 0.0  \n",
       "3                                    0.0                                 0.0  \n",
       "4                                    0.0                                 0.0  \n",
       "\n",
       "[5 rows x 604 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5., 3., 4., ..., 0., 0., 0.],\n",
       "       [4., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       ...,\n",
       "       [0., 0., 0., ..., 0., 0., 0.],\n",
       "       [5., 0., 0., ..., 0., 0., 0.],\n",
       "       [0., 0., 0., ..., 0., 0., 0.]])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.values[:,1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
